
let vm_manager = new Vue({
    el:"#mian",
    data:{
        flag:true
    },
    created:function () {
            axios.get("/currentManager").then(function (response) {
                    switch (response.data) {
                        case 2:
                            alert("请登录")
                            location.href='manager.html';
                            break;
                    }
            })
    }
    ,
    methods:{
        add:function () {
            if ($("input:first").val()!=null){
                // let data = $("form").serialize();
                let data = new FormData($("form")[0]);
                axios.post("/addDesign",data).then(function (r) {
                    switch (r.data) {
                        case 1:
                            alert("添加成功")
                            location.reload()
                            break;
                        case 2:
                            alert("请登录")
                            location.href="manager.html";
                            break;
                    }
                }).catch(function (err) {
                    alert(err);
                })
            }else {
                alert("请上传图片哦!")
            }
        },
        addAuther:function () {
            if ($("input:eq(0)").val()==null||$("input:eq(1)").val()==null||$("input:eq(2)").val()==null){
                    alert("请完善信息")
                    return;
            }

        },addAu:function () {
            // let data = $("form").serialize();
            let data = new FormData($("form")[0]);
            axios.post("/addAuther",data).then(function (response) {
                alert("添加成功")
                location.href="indexAuther.html";
            }).catch(function (err) {
                alert(err);
            })
        },addCategory:function (id) {

                if ($("input:eq(0)").val()==null||$("input:eq(1)").val()==null||$("input:eq(2)").val()==null||$("input:eq(3)").val()==null){
                    alert("添加信息不可为空")
                    return;
                }
                let data = new FormData($("form")[0]);
                axios.get("/addCategory").then(function (response) {
                        alert("添加成功")
                    location.href="indexCategory.html";
                }).catch(function (err) {
                        alert(err)
                })
        }
    }
})